package activity.addCamera;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hichip.campro.R;

import base.HiActivity;
import butterknife.BindView;
import common.TitleView;
import main.MainActivity;

/**
 * 确认通电窗口
 * Created by lt on 2018\2\10 0010.
 */

public class ConfirmElectriActivity extends HiActivity implements View.OnClickListener {
    @BindView(R.id.title) TitleView title;
    @BindView(R.id.tv_next_step) TextView tv_next_step;
    private int type;// 3是声波配置   1是从新设备跳转过来的

    @Override
    protected int setLayoutId() {
        return R.layout.activity_confirm_electri;
    }

    @Override
    protected void init(@Nullable Bundle savedInstanceState) {
        getIntentData();
        initViewAndData();
        setListeners();

    }

    private void getIntentData() {
        type = getIntent().getIntExtra("type", 0);
    }

    private void setListeners() {
        tv_next_step.setOnClickListener(this);

    }

    private void initViewAndData() {
        title.setTitle(getString(R.string.confirm_power));
        title.setButton(TitleView.NAVIGATION_BUTTON_LEFT);
        title.setRightTxtBack(R.mipmap.x_bule);
        title.setNavigationBarButtonListener(new TitleView.NavigationBarButtonListener() {
            @Override
            public void OnNavigationButtonClick(int which) {
                switch (which) {
                    case TitleView.NAVIGATION_BUTTON_LEFT:
                        ConfirmElectriActivity.this.finish();
                        break;
                    case TitleView.NAVIGATION_BUTTON_IV_RIGHT:
                        Intent intent=new Intent(ConfirmElectriActivity.this, MainActivity.class);
                        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        startActivity(intent,true);
                        break;
                }
            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_next_step:
                Intent intent = new Intent();
                if (type == 3) {
                    intent.setClass(ConfirmElectriActivity.this, SoundWavesWiFiOneKeySetActivity.class);
                } else if (type == 1) {
                    intent.setClass(ConfirmElectriActivity.this, AddNewDeviceActivity.class);
                } else {
                    intent.setClass(ConfirmElectriActivity.this, SeleDevHotSpotActivity.class);
                }
                startActivity(intent);
                break;
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
    }
}



